package com.yyh1;
/*创建一个员工数组
（3）根据以上数据,初始化员工数组
提示：把字符串转为int和double类型的值，
*/
/*
public class Test5 {
    public static void main(String[] args) {
        final int EMPLOYEE = 10;//表示普通员工
        final int PROGRAMMER = 11;//表示程序员
        final int DESIGNER = 12;//表示设计师
        final int ARCHITECT = 13;//表示架构师

        String[][] EMPLOYEES = {
                {"10", "1", "段誉", "22", "3000"},
                {"13", "2", "令狐冲", "32", "18000", "15000", "2000"},
                {"11", "3", "任我行", "23", "7000"},
                {"11", "4", "张三丰", "24", "7300"},
                {"12", "5", "周芷若", "28", "10000", "5000"},
                {"11", "6", "赵敏", "22", "6800"},
                {"12", "7", "张无忌", "29", "10800","5200"},
                {"13", "8", "韦小宝", "30", "19800", "15000", "2500"},
                {"12", "9", "杨过", "26", "9800", "5500"},
                {"11", "10", "小龙女", "21", "6600"},
                {"11", "11", "郭靖", "25", "7100"},
                {"12", "12", "黄蓉", "27", "9600", "4800"}
        };
        //创建员工数组
        Employee[] employees = new Employee[EMPLOYEES.length];
        // 根据数据初始化员工数组
        for (int i = 0; i < EMPLOYEES.length; i++) {
            String[] empData = EMPLOYEES[i];
            int type = Integer.parseInt(empData[0]);
            int id = Integer.parseInt(empData[1]);
            String name = empData[2];
            int age = Integer.parseInt(empData[3]);
            double salary = Double.parseDouble(empData[4]);

            switch (type) {
                case EMPLOYEE:
                    employees[i] = new Employee(id, name, age, salary);
                    break;
                case PROGRAMMER:
                    employees[i] = new Programmer(id, name, age, salary);
                    break;
                case DESIGNER:
                    double bonus = Double.parseDouble(empData[5]);
                    employees[i] = new Designer(id, name, age, salary, bonus);
                    break;
                case ARCHITECT:
                    double architectBonus = Double.parseDouble(empData[5]);
                    int stock = Integer.parseInt(empData[6]);
                    employees[i] = new Architect(id, name, age, salary, stock);
                    break;
            }
        }

        // 遍历数组并显示
        System.out.println("编号\t姓名\t年龄\t薪资\t\t语言\t\t奖金\t\t股票");
        for (Employee emp : employees) {
            System.out.println(emp.getInfo());
        }
    }
}
class Employee {
    public int id;
    public String name;
    public int age;
    public double salary;
    public Employee(){
        super();
    }

    public Employee(int id, String name, int age, double salary) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
    public String getInfo(){
        return id+"\t"+name+"\t"+age+"\t"+salary;
    }
}
class Programmer extends Employee{
    public String language = "java";
    public Programmer(){
        super();
    }

    public Programmer(int id, String name, int age, double salary) {
        super(id, name, age, salary);
    }

    public Programmer(int id, String name, int age, double salary, String language) {
        super(id, name, age, salary);
        this.language = language;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }
    public String getInfo(){
        return super.getInfo()+"\t"+language;
    }
}
class Designer extends Programmer{
    public double bonus;
    public Designer(){
        super();
    }

    public Designer(int id, String name, int age, double salary) {
        super(id, name, age, salary);
    }

    public Designer(int id, String name, int age, double salary, String language, double bonus) {
        super(id, name, age, salary, language);
        this.bonus = bonus;
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }
    public String getInfo(){
        return super.getInfo()+"\t"+bonus;
    }
}
class Architect extends Designer{
    public int stock;
    public Architect(){
        super();
    }

    public Architect(int id, String name, int age, double salary, String language, double bonus) {
        super(id, name, age, salary, language, bonus);
    }

    public Architect(int id, String name, int age, double salary, int stock) {
        super(id, name, age, salary, language, bonus);
        this.stock = stock;
    }

    public int getStock() {
        return stock;
    }

    public void setStock(int stock) {
        this.stock = stock;
    }
    public String getInfo(){
        return super.getInfo()+"\t"+stock;
    }
}

*/
